# -*- coding: utf-8 -*-
# @Time    : 2022/1/11 16:43
# @Author  : mzp
# @Email   : 2609404548@qq.com
# @File    : tjrc_page.py
# @Software: PyCharm

"""添加日程"""

from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import  Select
from pages.base_page import BasePage
from pages.jrrz_page import Djrc
class TjRz(BasePage):
    zt_locator = (By.ID, "subject")  # 主题
    fzqr_locator = (
    By.CSS_SELECTOR, "body > div:nth-child(9) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix "
                     "> div > button:nth-child(1) > span")

    kssj_locator = (By.ID, "start_date")
    jsjj_locator = (By.ID, "end_date")
    dd_locator = (By.ID, "venue")  # 地点
    xg_locator = (By.ID, "select1")
    sj_locator = (By.CSS_SELECTOR, "#select1 > option:nth-child(5)")
    xzsj_locator = (By.ID, "module_name")

    xuzsj_locator = (By.NAME, "business")
    sjqr_locator = (By.XPATH, "/html/body/div[11]/div[3]/div/button[1]")
    ms_locator = (By.CSS_SELECTOR, "body > div.container > div.row > div > form > table > tbody > tr:nth-child(6) > "
                            "td:nth-child(2) > textarea")
    bc_locator = (By.CSS_SELECTOR, "input[value=保存]")





    def rzzt(self):
        self.driver.find_element(*self.zt_locator).send_keys("你不知道的朝鲜")

    def xzsj(self):
        self.driver.find_element(*self.kssj_locator).send_keys("2022-1-8")
    def xzjssj(self):
        self.driver.find_element(*self.jsjj_locator).send_keys("2021-1-12")
    def srdd(self):
        self.driver.find_element(*self.dd_locator).send_keys("成都")
    def sjxlk(self):
        flei = self.driver.find_element(*self.xg_locator)
        lect = Select(flei)
        lect.select_by_visible_text("商机")
        self.driver.find_element(*self.sj_locator).click()
    def sjdj(self):
        self.driver.find_element(*self.xzsj_locator).click()     #选择相关点击框
    def xsj(self):
        self.driver.find_element(*self.xuzsj_locator).click()
    def xsqr(self):
        self.driver.find_element(*self.sjqr_locator).click()
    def rcnr(self,nr):
        self.driver.find_element(*self.ms_locator).send_keys(nr)
    def rcbc(self):
        self.driver.find_element(*self.bc_locator).click()

    dy_locator = (By.XPATH, '/html/body/div[5]/div[2]')

    def dy_text(self):
        return self.driver.find_element(*self.dy_locator).text
